﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace CommonLib
{
	public interface AssetFile
	{
		/// <summary>
		/// 文件句柄
		/// </summary>
		string ID { get; }
		AssetFileType Type { get; }
		bool IsError { get; }
		bool IsComplete { get; }
		AssetLoadError ErrorMessage { get; }

		int ReferenceCount { get; }
		/// <summary>
		/// 添加引用数
		/// </summary>
		/// <param name="obj"></param>
		void RfAdd(Object obj);
		/// <summary>
		/// 移除引用
		/// </summary>
		/// <param name="obj"></param>
		void RfRemove(Object obj);
		/// <summary>
		/// 将物件与物体链接
		/// </summary>
		/// <param name="link"></param>
		void AddReferenceComponent(GameObject link);

		T GetFile<T>() where T : UnityEngine.Object;
	}

	/// <summary>
	/// 加载顺序的优先级
	/// </summary>
	public enum AssetFileLoadPriority
	{
		Default = 0,
		Preload = 1,
		BackGround = 2,
		DownloadOnly = 3
	}

	/// <summary>
	/// 文件的类型
	/// </summary>
	public enum AssetFileType
	{
		None = 0,           //默认
		Sound = 1,          //声音资源
		Movie = 2,          //视频资源
		Texture = 3,        //图片资源
		Text = 4,           //文本资源
		UnityObject = 5     //物件资源
	}


	/// <summary>
	///文件加载的位置类型  
	/// </summary>
	public enum AssetFilePathType
	{
		None = 0,
		Server = 1,
		Persistent = 2,
		StreamingAssets = 3,
		Resources = 4
	}


	/// <summary>
	/// 资源加载时出现的错误
	/// </summary>
	public enum AssetLoadError
	{
		None = 0,
		PathError = 1,
		FileError = 2,
		NetError = 3
	}

	public delegate void AssetFileLoadEvent(AssetFile file);
	public delegate void AssetFileLoadEndEvent(AssetFile file);
}